<?php

namespace app\api\controller;
use think\Controller;
use think\Db;

class SysImgs extends Base
{
    public function __construct(){
        parent::__construct();
        $this->user=session('user');
    }
    //获取系统图片
    public function getSysImgs($name='',$type='',$pageNum=1,$pageSize=20)
    {
        $where=[];
        if($name!=''){
            $where['name']=['like','%'.$name.'%'];
        }
        if($type!=''){
            $where['type']=$type;
        }
        $data = Db::name('imgs_sys')->where($where)->page($pageNum,$pageSize)->select();
        $count = Db::name('imgs_sys')->where($where)->count();
        return json(['code'=>200,'msg'=>'成功','data'=>$data,'count'=>$count,'success'=>true]);
    }
    //获取图片类型
    public function getSysImgTypes()
    {
        $data = Db::name('imgs_type')->select();
        return result(200,'获取成功！',$data);
    }
}